using Microsoft.Ccr.Core;
using System.ComponentModel;
using Microsoft.Dss.Core.Attributes;
using Microsoft.Dss.ServiceModel.Dssp;
//using Microsoft.Dss.ServiceModel.DsspServiceBase;
using System;
using System.Collections.Generic;
using W3C.Soap;
//using vexrobotics = VEXRobotics;
//using Microsoft.Dss.Core.DsspHttp;
//using System.Collections.ObjectModel;
//using System.Diagnostics;


namespace VEXRobotics
{
    /// <summary>
    /// Represents the status of the robot connection
    /// </summary>
    [DataContract]
    public class VEXStatusNotification
    {
        /// <summary>
        /// Default constructor
        /// </summary>
        public VEXStatusNotification()
        {
        }

        /// <summary>
        /// Initialization Constructor
        /// </summary>
        /// <param name="status"></param>
        public VEXStatusNotification(VEXConnectionStatus status)
        {
            this.Status = status;
        }

        [DataMember]
        public VEXConnectionStatus Status;
    }

    /// <summary>
    /// Set the configuration of the controller
    /// </summary>
    [DataContract]
    public class ConfigureRequest : Update<VEXSetConfiguration, PortSet<DefaultUpdateResponseType, Fault>>
    {
        /// <summary>
        /// Default Constructor
        /// </summary>
        public ConfigureRequest()
        {
        }

        /// <summary>
        /// Initialization Constructor
        /// </summary>
        public ConfigureRequest(VEXSetConfiguration body)
        {
            this.Body = body;
        }
    }

    /// <summary>
    /// Set one motor
    /// <remarks>Range = 0 to 255</remarks>
    /// </summary>
    #region SetMotor
    [DataContract]
    public class SetMotor
    {
        /// <summary>
        /// Which motor to set
        /// </summary>
        [DataMember]
        public MotorPort Motor;

        /// <summary>
        /// The power to set the motor to. (Range 0 to 255)
        /// </summary>
        [DataMember]
        public int Power;
    }

    [DataContract]
    public class SetMotorList
    {
        public SetMotorList()
        {
            Motors = new List<SetMotor>();
        }

        /// <summary>
        /// Which motors to set
        /// </summary>
        [DataMember]
        public List<SetMotor> Motors;
    }

    #endregion
    [DataContract]
    public class SetMotorRequest : Update<SetMotorList, PortSet<DefaultUpdateResponseType, Fault>> { }

    #region SetOutputPort
    /// <summary>
    /// Set a specific output port
    /// </summary>
    [DataContract]
    public class SetOutputPort
    {
        private SensorPort _port;
        private bool _state;

        /// <summary>
        /// Default constructor
        /// </summary>
        public SetOutputPort()
        {
            _state = false;
        }

        /// <summary>
        /// Port
        /// </summary>
        [DataMember()]
        public SensorPort Port
        {
            get { return this._port; }
            set { this._port = value; }
        }

        /// <summary>
        /// State
        /// </summary>
        [DataMember()]
        public bool State
        {
            get { return this._state; }
            set { this._state = value; }
        }
    };

    /// <summary>
    /// Set a specific output port
    /// </summary>
    [DataContract]
    public class SetOutputPortList
    {
        [DataMember()]
        public List<SetOutputPort> UpdatePorts;
    }
    #endregion
    [DataContract]
    public class SetOutputPortRequest : Update<SetOutputPortList, PortSet<DefaultUpdateResponseType, Fault>> { }


    /// <summary>
    /// internal port for sending commands
    /// </summary>
    [DataContract]
    public class SendVEXCommand : Submit<VEXCommand, PortSet<VEXResponse, Fault>>
    {
        public SendVEXCommand() { }
        public SendVEXCommand(VEXCommand cmd)
        {
            this.Body = cmd;
        }
    }
}
